package io.xccit.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.xccit.pojo.param.ProductSearchParam;
import io.xccit.pojo.product.Product;
import io.xccit.result.AjaxResult;
import io.xccit.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author CH_ywx
 * @date 2023-09-12
 * @description 商品搜索接口
 */
@Api(tags = "商品搜索接口")
@RestController
@RequestMapping("/product")
public class ProductSearchController {

    @Autowired
    private IProductService productService;

    @ApiOperation("商品列表")
    @GetMapping("/list")
    public List<Product> productList(){
        return productService.productList();
    }

    @ApiOperation("商品搜索")
    @PostMapping("/search")
    public AjaxResult searchProduct(@RequestBody ProductSearchParam productSearchParam){
        return productService.searchProduct(productSearchParam);
    }
}
